UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KnVIzsiD08HRVoLoK1/+OX4EYpZyByZesME4eeoQuGo=' 
WHERE 
  key_id = 'c85d485130d115973b70a3b2b17861fae807eab8b39ac5b88153f90a750533e8' 
  AND (
    token = 'KnVIzsiD08HRVoLoK1/+OX4EYpZyByZesME4eeoQuGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029