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

Query time 0.00031