UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6fW4y4s0oTAXXPNhGF3xI9VWslu0kDxpShKGZic5u1A=' 
WHERE 
  key_id = '17e6e65c7a360669394850092ac30fc440016d3218244a8a2886c75371b4ae89' 
  AND (
    token = '6fW4y4s0oTAXXPNhGF3xI9VWslu0kDxpShKGZic5u1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022