UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dj8Ga3KXY/cQjZDQuO6HPpzHdhRppFbAqVyALmUU+vk=' 
WHERE 
  key_id = '09caccce820a6321bd875360c35ffcd0e52692f151d0aca8ac66a77a5e99c356' 
  AND (
    token = 'dj8Ga3KXY/cQjZDQuO6HPpzHdhRppFbAqVyALmUU+vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023