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

Query time 0.00038