UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RMnLgjA5jwW7cHn8FGZWj+sMyS3reiP9mLXBHDDuEQY=' 
WHERE 
  key_id = '889f321741622cf8d9fed8e09638d8ca5d252279005c57cb172f29b7b65038f5' 
  AND (
    token = 'RMnLgjA5jwW7cHn8FGZWj+sMyS3reiP9mLXBHDDuEQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025