UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9OS1ZLIM+Ej4FJ8gBUDai/fKI+qnFTK0DbfGLxIV+8s='
WHERE
key_id = '290a8f092d814414f56b6518170eb94c5511b1e651932f23a3ee905f4657ae7d'
AND (
token = '9OS1ZLIM+Ej4FJ8gBUDai/fKI+qnFTK0DbfGLxIV+8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)