UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P9HdkJlqKDu5xWodJHH5E9iDkWCL5Xf/sKfFNGW0JW0='
WHERE
key_id = 'a3ec7c22d70e10c96a4f2f299429126397eda35979ff43c4ac7cb8030bbe19bf'
AND (
token = 'P9HdkJlqKDu5xWodJHH5E9iDkWCL5Xf/sKfFNGW0JW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)