UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qphnfblAkJpB5Q6clZDcSFNmSycjGogrcBCEm8TUwtw=' 
WHERE 
  key_id = 'f40e6bb7c6243febff1c3b60a252a8db37d4dd632e8c5a05ed7c44c2194d7afb' 
  AND (
    token = 'qphnfblAkJpB5Q6clZDcSFNmSycjGogrcBCEm8TUwtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054