UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+XSgBLn/Qd/z1waAzW5eBe/pCVttg79WGSvDx2dKuRk=' 
WHERE 
  key_id = 'f8325a0c54058ee9536846a04b6652da2e2104793951cd32e9ea41697db02502' 
  AND (
    token = '+XSgBLn/Qd/z1waAzW5eBe/pCVttg79WGSvDx2dKuRk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041