UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UkwtNxekO0mo3ce8mAo2IGAjr0KX01Hm64V/9gDoTq8='
WHERE
key_id = 'c43bb8c8da6306dc98ea35215b0fdffe5339738ec42d052ce577b31d24fdca6d'
AND (
token = 'UkwtNxekO0mo3ce8mAo2IGAjr0KX01Hm64V/9gDoTq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)