UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7PLBf5sfAqT17cD9DxjPoEVAV7p8Qb9LrUNVNWyosvY='
WHERE
key_id = '31bdb49f2ba5c16a60c3168ff9a0d7e19ec052b6c0681d3fef625c1e0f1a745c'
AND (
token = '7PLBf5sfAqT17cD9DxjPoEVAV7p8Qb9LrUNVNWyosvY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)