UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VQNaKB23kHcqucsLQtt5NCt4osHhfPCCRbnhUA7Agwc='
WHERE
key_id = 'd5d5431547fd7f5c0b6cc8969ee7d04db830c8742969c5a2e1e76540368f7293'
AND (
token = 'VQNaKB23kHcqucsLQtt5NCt4osHhfPCCRbnhUA7Agwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)