UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BbUvkSdH5Rh4kI/9lqfqxrzMt1Xa69HlyyODvwC81lQ=' 
WHERE 
  key_id = 'f4e9c0306c4619a5938506b3aae94882181a53d4d1a6aad742419864b4308ed4' 
  AND (
    token = 'BbUvkSdH5Rh4kI/9lqfqxrzMt1Xa69HlyyODvwC81lQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030