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