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