UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2y0dx7s5G9D64ascnXCDZnkxFcv5cVzqTAg7WCpZNhc=' 
WHERE 
  key_id = '325ef2a84eed7fc41a2e3c211b1c748034d6404709af1a6e76b316d02fae5823' 
  AND (
    token = '2y0dx7s5G9D64ascnXCDZnkxFcv5cVzqTAg7WCpZNhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048