UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hiEMtDuzrQFxlAfeTc8Ka5vBXK74A+xbXxS/ONd3TPY=' 
WHERE 
  key_id = '2e205f78e8b354abb79656b1152290dd684ae9f15b0b9c69cd67134f03ebb732' 
  AND (
    token = 'hiEMtDuzrQFxlAfeTc8Ka5vBXK74A+xbXxS/ONd3TPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024