UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Iv7cUzSqylan2EygSlb9/+/A/EyiEhkfDFX6MbEXOw='
WHERE
key_id = '65c5bdcf77f0af0c6ed87fe8a8995b56408c00cf08aa1dbab6635b80a228416d'
AND (
token = '7Iv7cUzSqylan2EygSlb9/+/A/EyiEhkfDFX6MbEXOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)