UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fMxM3qrnd7tHLK9F1lp82/qCjzbfZxETPfI8jEJvroY='
WHERE
key_id = 'c5f0b59545c3b90fdce32a9e99c4a43ae1bcbd06cbc457dd980388a1b5551350'
AND (
token = 'fMxM3qrnd7tHLK9F1lp82/qCjzbfZxETPfI8jEJvroY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)