UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpYyECY3Tg5MOBn+0eHDNf1P+FeLjif12DCc0rpQcHY='
WHERE
key_id = '8b28501258532f12b5926e75b6e5257c1838b8c9e9924cc57b53dcf7801c0ddd'
AND (
token = 'tpYyECY3Tg5MOBn+0eHDNf1P+FeLjif12DCc0rpQcHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)