UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z4nzRCmvZxSG8y2AQe4S9d4xg+bAQYYkgBl/5J++cak='
WHERE
key_id = '4f8a7d8625027859c3499a4aeb75897d58260ecba4fed54218a469ce30b5db7d'
AND (
token = 'Z4nzRCmvZxSG8y2AQe4S9d4xg+bAQYYkgBl/5J++cak='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)