UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ChOznxncum0t1a4ML3Jsud5SbaS9yWGF7ulhRrexsw=' 
WHERE 
  key_id = 'bad9db04008ae3eef59da5400671c22e55f1de374e6c29a767fe72c03281e9aa' 
  AND (
    token = '5ChOznxncum0t1a4ML3Jsud5SbaS9yWGF7ulhRrexsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022