UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'clJJIJmqSk32YHy8hFiLtnlAO6zkx5UhH2Gzhk2y0s8='
WHERE
key_id = '66b303199c9dce07ae57d1a43c66501bbeb35714764d144d4e0e7ae61563f5f0'
AND (
token = 'clJJIJmqSk32YHy8hFiLtnlAO6zkx5UhH2Gzhk2y0s8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)