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