UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kYE3cLicnSngQsrs7YJIWHmDiyPQSGuDDhgfIWkvdLI='
WHERE
key_id = 'd8671c43fc027be17c7c1f8f1dc407df837a7cdbd9e03ce46e44645b5c51f9c1'
AND (
token = 'kYE3cLicnSngQsrs7YJIWHmDiyPQSGuDDhgfIWkvdLI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)