UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwED9VJQGawPurFHmVid+pzzgwmj0E61nrPQKNGGZHc=' 
WHERE 
  key_id = '15ff09b433b83d1682a68c0e4b3667988f90814df5a047c22292e3e3308ecbad' 
  AND (
    token = 'iwED9VJQGawPurFHmVid+pzzgwmj0E61nrPQKNGGZHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040