UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AEKtRs36K46S2KsD1MNfT/btG4hvQWeNYalyuiNOwVo='
WHERE
key_id = 'e876a401a7ae8bdfbda31706ea805b677e25c81e2c1da0f3335505fd35901ad8'
AND (
token = 'AEKtRs36K46S2KsD1MNfT/btG4hvQWeNYalyuiNOwVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)