UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P3aXqCHTGlmhlfWJZ859/15wsaVOuDTOc5MMqrA3ZE4='
WHERE
key_id = '46db8baa5ff1ea517e071fc4e0cc0c210fa689fb047e8a23404927aedbc303c9'
AND (
token = 'P3aXqCHTGlmhlfWJZ859/15wsaVOuDTOc5MMqrA3ZE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)