UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZUK739aamTiG5s9k5Piq+2zLckVcwbd/YR2eUED/W8M='
WHERE
key_id = '32ac6e24db4438a2d43f6da92961cb47ef591ab629da1c57cbe1319823fda780'
AND (
token = 'ZUK739aamTiG5s9k5Piq+2zLckVcwbd/YR2eUED/W8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)