UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'piNIY7p8nYtwgiPvkG+SlON//bH9kbvwc0G1kxFxNDs=' 
WHERE 
  key_id = 'a60ffb486262a688fa49fab404fa8bc0b3c0dacf379c31b302d930da1a754f1e' 
  AND (
    token = 'piNIY7p8nYtwgiPvkG+SlON//bH9kbvwc0G1kxFxNDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00091