UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p17ZXfz8tJGcUK0ElvzEUTR/YXOjley3EWy64k6vpRU='
WHERE
key_id = 'b30bed42c901b75b6354181fc1bce8eafbbdd7e865438e69e5c7384c4dacf4ef'
AND (
token = 'p17ZXfz8tJGcUK0ElvzEUTR/YXOjley3EWy64k6vpRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)