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