UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QGNGYBqKbAkmzYu2AEQiU+EPq6ieB4QNTFrK9RUC1F0='
WHERE
key_id = '505ff0ddb09b6cd033f22fb02eca3714b775009388da84a453644f986ff3131a'
AND (
token = 'QGNGYBqKbAkmzYu2AEQiU+EPq6ieB4QNTFrK9RUC1F0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)