UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Pw+X4cXrpx2us39fY3W0f9ivgtpCveVYQdEZIsv1U4='
WHERE
key_id = '7b27d6406268d6d2fdc7461875287fba327c5948e670f1d5f262d2a2d05c8443'
AND (
token = '6Pw+X4cXrpx2us39fY3W0f9ivgtpCveVYQdEZIsv1U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)