UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XKIOrN1FeQFjRLk7L0qIaYylHH95X84wj0dq3gxNp8Y=' 
WHERE 
  key_id = '2a7c15124d27942e5b8d0fa33809a4ae883cd4f84d9500d048ba592da2dee15b' 
  AND (
    token = 'XKIOrN1FeQFjRLk7L0qIaYylHH95X84wj0dq3gxNp8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029