UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6QMMAkYDIXeAXqqTEC5vmdc11a1zGnd/cGtyaKSiLkg='
WHERE
key_id = '391a784c937beb6d7f070a1aef9add6339e376f171e401ad46ee5d052ec69ebb'
AND (
token = '6QMMAkYDIXeAXqqTEC5vmdc11a1zGnd/cGtyaKSiLkg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)