UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KdlhxJtYOEiKGDx8mK29Sleym9ZMKIQmt5b7oquH+dI='
WHERE
key_id = 'cb3983e0cee886e736dd56d26598f5186cbc1c5fa78e39b662b60207f5ae3da2'
AND (
token = 'KdlhxJtYOEiKGDx8mK29Sleym9ZMKIQmt5b7oquH+dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)