UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0JjyJju+hb8fSthstEH6jp46KUl+NAt6vrhkHhxF04=' 
WHERE 
  key_id = '6073e4222ff45bb7c496591336a66671530c094650b8ea6857df300243c2d3fe' 
  AND (
    token = 'a0JjyJju+hb8fSthstEH6jp46KUl+NAt6vrhkHhxF04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038