UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4i8tR5EccaXE02P1lCOQo3ECtQAT5GyPYWiCLu5Ygu4='
WHERE
key_id = '3de1163e73f7061e9f0ddfc2754624aa22ccaf82fd23b2121cbc07d9739e91e2'
AND (
token = '4i8tR5EccaXE02P1lCOQo3ECtQAT5GyPYWiCLu5Ygu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)