UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i/wRZgt4qeX53+N+rBHHNZQwFeJRIEoi+PLFKrw4Ljs='
WHERE
key_id = 'af776d15e873a83e6ced6bb2a9959ceea9e5e2ec7e0f6c26bf6641cea2d36a2d'
AND (
token = 'i/wRZgt4qeX53+N+rBHHNZQwFeJRIEoi+PLFKrw4Ljs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)