UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O9FbKinVWTLqlaak3qIFFvJwV0hyBM9VoLFiDhonMHM='
WHERE
key_id = '67f5d9ad9a5f48d975e598dea895dc830d5e232654e581e10a4ebe98567a10d2'
AND (
token = 'O9FbKinVWTLqlaak3qIFFvJwV0hyBM9VoLFiDhonMHM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)