UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lq/gZBVNdwFk3Myeu6upnTFMtN1WRsMBgHIlGxMA9h8='
WHERE
key_id = 'ef4e64b13265e3a00afeea88e07f5949a7b131b17143eb66846dc9df5086cd02'
AND (
token = 'Lq/gZBVNdwFk3Myeu6upnTFMtN1WRsMBgHIlGxMA9h8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)